package com.teckteam.ptvsystem.view;

import java.awt.Color;
import java.awt.GridLayout;
import java.util.ArrayList;

import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.teckteam.ptvsystem.model.ResultNode;
import com.teckteam.ptvsystem.model.facade.PTVConstants;

/**
 * Journey choice selection after Journey Planner completes its search
 * STUB
 */
public class JourneyChoiceWindow extends JDialog
{
   private JLabel optionT, departT, arriveT, durationT,
                  changesT, viewT,
                  
                  option[] = new JLabel[PTVConstants.NUM_JOURNEYS],
                  depart[] = new JLabel[PTVConstants.NUM_JOURNEYS], 
                  arrive[] = new JLabel[PTVConstants.NUM_JOURNEYS],
                  duration[] = new JLabel[PTVConstants.NUM_JOURNEYS], 
                  changes[] = new JLabel[PTVConstants.NUM_JOURNEYS],
                  view[] = new JLabel[PTVConstants.NUM_JOURNEYS];
   
   /**
    * Construct and show new journey choice dialog box
    * NOTE: This feature has not been implemented (refer to JourneyChoiceTest.java to see what it does)
    */
   public JourneyChoiceWindow(ArrayList<ArrayList<ResultNode>> resultList)
   {
      
      // Four results
      
      // Option Depart Arrive Duration Changes Map Zones View
      
      // 1 Time time dur modes displaymap NoofZones Actual Stop information
      // 2
      // 3
      // 4
      
      JPanel resultPanel = new JPanel(new GridLayout(5, 0));
      
      JPanel titleList = new JPanel();
      JPanel result[] = new JPanel[PTVConstants.NUM_JOURNEYS];
      for(int i=0; i<PTVConstants.NUM_JOURNEYS; i++)
         result[i] = new JPanel(new GridLayout(0, 6));
      
      optionT = new JLabel(" Option ");
      departT = new JLabel(" Depart ");
      arriveT = new JLabel(" Arrive ");
      durationT = new JLabel(" Duration ");
      changesT = new JLabel(" Changes ");
      viewT = new JLabel(" View ");
      
      titleList.setLayout(new GridLayout(0, 6));
      
      for(int i=0; i<PTVConstants.NUM_JOURNEYS; i++)
      {
         option[i] = new JLabel("1");
         depart[i] = new JLabel("Mon, 3:49 pm");
         arrive[i] = new JLabel("Mon, 3:57 pm");
         duration[i] = new JLabel("0h 08m");
         changes[i] = new JLabel("0");
         view[i] = new JLabel("Details");
         
         option[i].setBorder(BorderFactory.createLineBorder(Color.black));
         depart[i].setBorder(BorderFactory.createLineBorder(Color.black));
         arrive[i].setBorder(BorderFactory.createLineBorder(Color.black));
         duration[i].setBorder(BorderFactory.createLineBorder(Color.black));
         changes[i].setBorder(BorderFactory.createLineBorder(Color.black));
         view[i].setBorder(BorderFactory.createLineBorder(Color.black));
         
         result[i].add(option[i]);
         result[i].add(depart[i]);
         result[i].add(arrive[i]);
         result[i].add(duration[i]);
         result[i].add(changes[i]);
         result[i].add(view[i]);
      }
      
      titleList.add(optionT);
      titleList.add(departT);
      titleList.add(arriveT);
      titleList.add(durationT);
      titleList.add(changesT);
      titleList.add(viewT);
      
      this.setTitle("PTV System Results Panel");
      
      resultPanel.add(titleList);
      for(JPanel j : result) resultPanel.add(j);
      
      this.setContentPane(resultPanel);
      this.setBounds(0, 0, 1000, 500);
      this.setVisible(true);
      
   }
   
}